package it.csi.finregio.finreges.client.validators.mantab;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;

import it.crp.crparch.web.struts.validator.CRPStrutsValidator;
import it.crp.crparch.web.struts.validator.ValidatorHelper;
import it.csi.finregio.finreges.presentation.form.SchedaForm;

public class AssessoratoValidator implements CRPStrutsValidator {

	public ActionMessages validate(ActionMapping mapping,
			HttpServletRequest request, ActionForm form) {
		SchedaForm sf = (SchedaForm) form;
		ActionMessages am = new ActionMessages();
		if(sf.getDescrizioneAssessorato()==null || sf.getDescrizioneAssessorato().trim().equals("")){
			ValidatorHelper.putError("assessorato", "alert.field.mandatory", new Object[]{"Assessorato"}, am);
		}
		return am;
	}

}
